<style>
    td.left {text-align: left;}
    td.right {text-align: right;}
</style>
<div>
    <h1 style="text-align:center">本周完成任务</h1>
    #for(g:groups)
        #set(groupinited=0)
        #set(groupcnt=0)
        #set(mancnt=0)
        #set(groupattendancehour=0.0)
        #set(grouptotalhour=0.0)
        #for(x:weektaskstatistics)
            #if(x.xGroup==g.xGroup)
                #set(mancnt=mancnt+1)
                #for(y:weekalltasks)
                    #if(x.xMan==y.xMan)
                        #set(groupcnt=groupcnt+1)
                    #end
                #end
            #end
        #end
        <div style="margin-top:2em;margin-bottom:2em;">
            <table class="gradienttable" border="1" style="width:100%;line-height:2em;">
                <tr>
                    <th style="width:5em;">ID</th>
                    <th>标题</th>
                    <th style="width:3em;">状态</th>
                    <th style="width:6em;">标签</th>
                    <th style="width:7em;">客户</th>
                    <th style="width:3em;">优先级</th>
                    <th style="width:3em;">处理人</th>
                    <th style="width:6em;">完成时间</th>
                    <th style="width:4em;">预估工时</th>
                    <th style="width:4em;">开发工时</th>
                    <th style="width:4em;">个人效率</th>
                    <th style="width:7em;">小组</th>
                </tr>

                #for(x:weektaskstatistics)
                    #if(x.xGroup==g.xGroup)
                        #set(xman=x.xMan)
                        #set(totalplanhour=0.0)
                        #set(totalhour=0.0)
                        #set(taskcnt=0)
                        #set(inited=0)
                        #for(y:weekalltasks)
                            #if(x.xMan==y.xMan)
                                #set(taskcnt=taskcnt+1)
                            #end
                        #end
                        #for(y:weekalltasks)
                            #if(x.xMan==y.xMan)
                                #set(totalplanhour=totalplanhour+y.xPlanHour)
                                #set(totalhour=totalhour+y.xHour)
                                <tr>
                                    <td>#(y.xShortID)</td>  <!--超链接-->
                                    <td style="text-align:left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 20ch;">
                                        <a href="https://www.tapd.cn/#(y.rWorkspace_ID)/prong/tasks/view/#(y.sID)" target="_blank">#(y.xName)</a>
                                    </td> <!--左对齐-->
                                    <td>已完成</td>
                                    <td>#(y.xLabel)</td>
                                    <td>#(y._Cust_Name)</td>
                                    <td>#(y.xPriority)</td>
                                    <td>#(y.xMan)</td>
                                    <td>#date(y.xFinishTime,"MM-dd HH:mm")</td>
                                    <td>#(y.xPlanHour)</td>
                                    <td>#(y.xHour)</td>
                                    #if(inited==0) <td rowspan="#(taskcnt+1)" id="taskcnt_#(y.xMan)">&nbsp;</td> #end
                                    #if(groupinited==0) 
                                        <td rowspan="#(groupcnt+mancnt)"  style="vertical-align: top;">
                                            <table style="width:100%;">
                                                <tr>
                                                    <td style="text-align:right;width:3em;">&nbsp;</td>
                                                    <td style="text-align:left;">&nbsp;</td>
                                                </tr>
                                                <tr>
                                                    <td style="text-align:center;width:100%;" colspan="2"><b>#(g.xGroup)</b></td>
                                                </tr>
                                                <tr>
                                                    <td style="text-align:right;width:3em;">工时:</td>
                                                    <td style="text-align:left;">#number(x.xGroupHour,"0.#")</td>
                                                </tr>
                                                <tr>
                                                    <td style="text-align:right;width:3em;">人数:</td>
                                                    <td style="text-align:left;">#(x.xManCnt)</td>
                                                </tr>
                                                <tr>
                                                    <td style="text-align:right;width:3em;">天数:</td>
                                                    <td style="text-align:left;">#(x.xDayCnt)</td>
                                                </tr>
                                                <tr>
                                                    <td style="text-align:right;width:3em;">效率:</td>
                                                    <td style="text-align:left;"><div id="groupeffect_#(g.xGroup)"></div></td>
                                                </tr>
                                            </table>
                                        </td> 
                                        #set(groupinited=1)
                                    #end
                                </tr>
                                #set(inited=1)
                            #end
                            
                        #end
                        
                        <tr>
                            <td colspan="8">合计</td>
							<!-- <td>#(totalplanhour)</td> -->
							<!-- <td>#(totalhour)</td> -->
							<td>#number(totalplanhour, "0.#")</td>
							<td>#number(totalhour,"0.#")</td>
                            <script>
                                
                                var rate = '#if(totalHour>0)#number(totalhour/(totalHour*x.xCountRate),"0.#%") #else 0.0 #end';
                                document.getElementById('taskcnt_#(xman)').textContent = rate;
                            </script>
                            #if(x.xIsCount)
                                #set(grouptotalhour=grouptotalhour+totalhour)
                                #set(groupattendancehour=groupattendancehour+totalHour*x.xCountRate)
                            #end
                        </tr>
                        #set(groupinited=1)
                    #end
                #end
            </table>
        </div>
        <script>
            var grouptotalhour = #(grouptotalhour);
            var grouptotalhourrate = '#if(groupattendancehour>0)#number(grouptotalhour/groupattendancehour,"0.#%") #else 0.0 #end';
            document.getElementById('groupeffect_#(g.xGroup)').textContent = grouptotalhourrate
        </script>

    #end
</div>



